package com.csc.bankingsystem.core.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import com.csc.bankingsystem.core.enumeration.UserRoleNameEnum;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;

/**
 * UserInfo Data Transfer Object
 * 
 * @author angelkid
 *
 */
@Entity
@Table(name = "USERROLE")
public class UserRole  extends BankingSystemAbstractEntity {
	private UserRoleNameEnum role;

	//Reference Data
	private List<UserInfoRole> userInfoRoles;
		
	@Column(name = "role",unique = true, nullable = false)
	@Enumerated(EnumType.STRING)
	public UserRoleNameEnum getRole() {
		return role;
	}

	public void setRole(UserRoleNameEnum role) {
		this.role = role;
	}

//	,cascade=CascadeType.ALL
	@JsonBackReference
	@OneToMany (mappedBy="userRole")
	public List<UserInfoRole> getUserInfoRoles() {
		return userInfoRoles;
	}

	public void setUserInfoRoles(List<UserInfoRole> userInfoRoles) {
		this.userInfoRoles = userInfoRoles;
	}
	
	
}
